﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ModelLayer
{
    public class Movie
    {
        private int id;
        private string title;
        private int playLength;
        private string actor;
        private int minAge;
        private string description;
        private string rating;
        private string director;
        private string genre;
        private string language;
        private decimal price;
        private string licencee;
        private DateTime rentalDateStart;
        private DateTime rentalDateEnd;
        private bool active;

        public Movie(bool active, string title, int playLength, string actor, int minAge, string description, string rating, string director, string genre, 
            string language, decimal price, string licencee, DateTime rentalDateStart, DateTime rentalDateEnd)
        {
            this.active = active;
            this.title = title;
            this.playLength = playLength;
            this.actor = actor;
            this.minAge = minAge;
            this.description = description;
            this.rating = rating;
            this.director = director;
            this.genre = genre;
            this.language = language;
            this.price = price;
            this.licencee = licencee;
            this.rentalDateStart = rentalDateStart;
            this.rentalDateEnd = rentalDateEnd;
        }

        public Movie(int id, bool active, string title, int playLength, string actor, int minAge, string description, string rating, string director, string genre,
            string language, decimal price, string licencee, DateTime rentalDateStart, DateTime rentalDateEnd)
        {
            this.id = id;
            this.active = active;
            this.title = title;
            this.playLength = playLength;
            this.actor = actor;
            this.minAge = minAge;
            this.description = description;
            this.rating = rating;
            this.director = director;
            this.genre = genre;
            this.language = language;
            this.price = price;
            this.licencee = licencee;
            this.rentalDateStart = rentalDateStart;
            this.rentalDateEnd = rentalDateEnd;
        }

        public Movie()
        {
        }

        public Movie(string title)
        {
            this.title = title;
        }

        public override string ToString()
        {
            return this.title;
        }

        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        public int PlayLength
        {
            get { return playLength; }
            set { playLength = value; }
        }

        public string Actor
        {
            get { return actor; }
            set { actor = value; }
        }

        public int MinAge
        {
            get { return minAge; }
            set { minAge = value; }
        }

        public string Description
        {
            get { return description; }
            set { description = value; }
        }

        public string Rating
        {
            get { return rating; }
            set { rating = value; }
        }

        public string Director
        {
            get { return director; }
            set { director = value; }
        }

        public string Genre
        {
            get { return genre; }
            set { genre = value; }
        }

        public string Language
        {
            get { return language; }
            set { language = value; }
        }

        public decimal Price
        {
            get { return price; }
            set { price = value; }
        }

        public string Licencee
        {
            get { return licencee; }
            set { licencee = value; }
        }

        public DateTime RentalDateStart
        {
            get { return rentalDateStart; }
            set { rentalDateStart = value; }
        }

        public DateTime RentalDateEnd
        {
            get { return rentalDateEnd; }
            set { rentalDateEnd = value; }
        }

        public bool Active
        {
            get { return active; }
            set { active = value; }
        }

        // override object.Equals
        public override bool Equals(object obj)
        {
            Movie m;
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            else if (obj is Movie)
            {
                m = (Movie)obj;

                return
                    this.Id.Equals(m.Id) &&
                    this.Title.Equals(m.Title) &&
                    this.PlayLength.Equals(m.PlayLength) &&
                    this.Actor.SequenceEqual(m.Actor) &&
                    this.MinAge.Equals(m.MinAge) &&
                    this.Description.Equals(m.Description) &&
                    this.Rating.Equals(m.Rating) &&
                    this.Director.Equals(m.Director) &&
                    this.Genre.Equals(m.Genre) &&
                    this.Language.Equals(m.Language) &&
                    this.Price.Equals(m.Price) &&
                    this.Licencee.Equals(m.Licencee) &&
                    this.RentalDateStart.Equals(m.RentalDateStart) &&
                    this.RentalDateEnd.Equals(m.RentalDateEnd);
            }
            else
            {
                return false;
            }

        }
    }
}
